package com.example.service.impl;

import com.example.mapper.SourceMapper;
import com.example.pojo.PageBean;
import com.example.pojo.Source;
import com.example.service.SourceService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SourceServicelmpl implements SourceService {

    @Autowired
    private SourceMapper sourceMapper;
    @Override
    public PageBean page(Integer page, Integer pageSize) {
        //  设置分页参数
        PageHelper.startPage(page,pageSize);
        //执行查询
        List<Source> SourceList = sourceMapper.list();
        Page<Source> p = (Page<Source>) SourceList;
        //封装pageBean对象
        PageBean pageBean = new PageBean(p.getTotal(), p.getResult());
        return pageBean;
    }

    @Override
    public void delete(List<Integer> ids) {
        sourceMapper.delete(ids);
    }
}